package com.fantasy.draby.controller;

import com.fantasy.draby.service.game.GameService;
import com.fantasy.draby.utils.JsonUtil;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("/game")
public class GameController {
    private final GameService gameService;

    public GameController(@Qualifier("gameService") GameService gameService) {
        this.gameService = gameService;
    }

    @RequestMapping("/queryAll")
    @ResponseBody
    public String queryAllGames() {
        return JsonUtil.toJson(gameService.queryAllGames());
    }
}
